package com.wangsong.controller;

import com.wangsong.model.User;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

@RestController
public class MVCController extends BaseController {

    //协议期处理
    @RequestMapping(value = "/age")
    public User name(@RequestBody User user) {
        return user;
    }

    //拦截器处理
    @RequestMapping(value = "/isName")
    public String age() {
        return "isName";
    }

    @RequestMapping(value = "/save")
    public String save(User user) {
        return user.toString();
    }

    @RequestMapping(value = "/save2")
    public String save(String s) {
        return "<a href=" + s + ">aaa</a>";
    }

    @RequestMapping(value = "/save3")
    public void save3(HttpServletResponse response) {
        response.addHeader("location", "http://www.baidu.com");
        response.setStatus(302);
    }


}
